﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microhard.Core;


namespace Microhard.Framework.MVCHelper
{
    public class UnityControllerFacotry : DefaultControllerFactory
    {
        protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
        {
            if (null == controllerType)
            {
                return null;
            }
            IController rtn = null;
            try
            {
                rtn= (IController)IoC.Resolve(controllerType);
            }
            catch (Exception ex)
            {
                Log.Error("UnityControllerFacotry", ex);
            }
            return rtn;
        }
    }
}
